#!/bin/bash

set -ex


# usage docker-shell <arch> <distro> [cmd]

# shared volume
shared_repo=/Repos
shared_data=/Data
shared_home=${HOME}
shared_misc=/misc

  arch=${1}
distro=${2}
   cmd=${3}

if [ $# == 0 ]; then
	#default arch and distro
	arch=amd64
	distro=bionic
fi


docker run --rm \
	-it \
	--privileged \
	-h ${distro} \
	-v ${shared_repo}:${shared_repo} \
	-v ${shared_data}:${shared_data} \
	-v ${shared_home}:${shared_home} \
	-v ${shared_misc}:${shared_misc} \
	-w ${PWD} \
	${distro}:${arch} ${cmd}
